/**
 * @author ：wang-ting
 * @Date：2025/4/26 14:44
 */
import java.util.Scanner;
import java.util.Arrays;
public class shuzu {
    public static void main(String[] args) {
        int[] arr1 = new int[]{1,2};
        int[] arr2 = new int[]{3,4};
        //Scanner sc = new Scanner(System.in);
//        for(int i = 0;i < 2;i++){
//            arr1[i] = sc.nextInt();
//        }
//        for(int j = 0 ;j < 2;j++){
//            arr2[j] = sc.nextInt();
//        }
        double m = findMedianSortedArrays(arr1,arr2);
        System.out.println(m);
    }
        public static double findMedianSortedArrays(int[] nums1, int[] nums2) {
            double m = 0.0;
            int[] sum = new int[nums1.length + nums2.length];
            for(int i = 0;i < nums1.length;i++){
                sum[i] = nums1[i];
            }
            int k = 0;
            for(int j = nums1.length;j <= sum.length;j++){
                while(k < nums2.length){
                    sum[j] = nums2[k];
                    k++;
                    break;
                }
//                for(int k = 0;k < nums2.length;k++){
//                    sum[j] = nums2[k];
//
//                }
            }
            Arrays.sort(sum);
            if(sum.length % 2 == 0){
                m = (sum[sum.length/2] + sum[(sum.length/2) - 1])* 1.0 / 2;
            }else{
                m = sum[sum.length / 2];
            }
            return m;
        }
}
